//
// $Id: BaseTest2.java,v 1.8 2007/05/02 21:34:06 vivaldi Exp $
//
// BUI - a user interface library for the JME 3D engine
// Copyright (C) 2005, Michael Bayne, All Rights Reserved
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

package eMdP.estats;

import com.jme.system.DisplaySystem;
import com.jme.util.Timer;
import com.jmex.bui.BButton;
import com.jmex.bui.BLabel;
import com.jmex.bui.BuiSystem;
import com.jmex.bui.PolledRootNode;
import com.jmex.bui.event.ActionEvent;
import com.jmex.bui.event.ActionListener;
import com.jmex.bui.util.Point;

import eMdP.gestors.GestorConstants;
import eMdP.gestors.GestorPantalla;

/**
 * A base class for our various visual tests.
 */
public class MenuDePausa extends GbuiGameState {
	
	private BButton boto;
	private BLabel text;
    
    public MenuDePausa(String name)
    {
    	super(name);
    	
    	System.out.println("Entro a menú de pausa");
    	//BuiSystem.init(new PolledRootNode(Timer.getTimer(), input), "/eMdP/styles/menuDePausa.bss");
    	
    	window.setSize((int)(display.getWidth()/2),(int)(display.getHeight()/2));
    	
 		int posicioY = window.getHeight()-GestorConstants.ALT_BOTO;
 		int ampleBoto = window.getWidth()/2;
 		int posicioX = window.getWidth()/4;
    	
    	text = new BLabel("Joc pausat");
    	text.setPreferredSize(window.getWidth(), GestorConstants.ALT_BOTO);
    	window.add(text, new Point(0, posicioY));
    	
    	posicioY = posicioY - GestorConstants.ALT_BOTO - GestorConstants.ESPAI_ENTRE_ELEMENTS_GBUI;
    	
    	boto = new BButton("Torna");
    	boto.setPreferredSize(ampleBoto, GestorConstants.ALT_BOTO);
    	boto.addListener(new ActionListener() {
    		@Override
    		public void actionPerformed(ActionEvent event)
    		{
    			GestorPantalla.rependrePartida();
    		}
    	});
    	window.add(boto, new Point(posicioX, posicioY));
    	
    	posicioY = GestorConstants.ESPAI_ENTRE_ELEMENTS_GBUI;
    	
    	boto = new BButton("Surt");
    	boto.setPreferredSize(ampleBoto, GestorConstants.ALT_BOTO);
    	boto.addListener(new ActionListener() {
    		@Override
    		public void actionPerformed(ActionEvent event)
    		{
    			GestorPantalla.abortarPartida();
    		}
    	});
    	window.add(boto, new Point(posicioX, posicioY));
    }
}
